package com.example.demo.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName = "pm_work_card_es", shards = 15)
public class EsPmWorkCard {

    @Id
    @Field(type = FieldType.Long)
    private Long id;

    @Field(type = FieldType.Keyword) // 工单号需精确匹配
    private String workOrderNo;

    @Field(type = FieldType.Long)
    private Long vesselId;

    @Field(type = FieldType.Keyword) // 编码类字段用Keyword
    private String vesselCode;

    @Field(type = FieldType.Keyword) // 中文名称需分词
    private String vesselNameCn;

    @Field(type = FieldType.Text, analyzer = "english") // 英文名称用英文分词器
    private String vesselNameEn;

    @Field(type = FieldType.Long)
    private Long devVesselCodeId;

    @Field(type = FieldType.Long)
    private Long devInfoId;

    @Field(type = FieldType.Keyword)
    private String devNameCn;

    @Field(type = FieldType.Text, analyzer = "english")
    private String devNameEn;

    @Field(type = FieldType.Long)
    private Long devJobId;

    @Field(type = FieldType.Keyword)
    private String jobName;

    @Field(type = FieldType.Keyword) // 工作内容需全文搜索
    private String jobContent;

    @Field(type = FieldType.Date)
    private Date earlyDate;

    @Field(type = FieldType.Date)
    private Date planDate;

    @Field(type = FieldType.Date)
    private Date lateDate;

    @Field(type = FieldType.Date)
    private Date arrangeDate;

    @Field(type = FieldType.Keyword) // 类型枚举值
    private String workCardType;

    @Field(type = FieldType.Keyword)
    private String triggerCondition;

    @Field(type = FieldType.Long)
    private Long periodId;

    @Field(type = FieldType.Integer)
    private Integer timerJobPeriod;

    @Field(type = FieldType.Keyword)
    private String timerJobPeriodUnit;

    @Field(type = FieldType.Integer)
    private Integer timerJobSpanLeft;

    @Field(type = FieldType.Integer)
    private Integer timerJobSpanRight;

    @Field(type = FieldType.Integer)
    private Integer regularJobPeriod;

    @Field(type = FieldType.Keyword)
    private String regularJobPeriodUnit;

    @Field(type = FieldType.Integer)
    private Integer regularJobSpanLeft;

    @Field(type = FieldType.Integer)
    private Integer regularJobSpanRight;

    @Field(type = FieldType.Integer)
    private Integer specifiedDate;

    @Field(type = FieldType.Keyword)
    private String surveyCode;

    @Field(type = FieldType.Boolean)
    private Boolean surveyFlag;

    @Field(type = FieldType.Boolean)
    private Boolean importantFlag;

    @Field(type = FieldType.Boolean)
    private Boolean riskFlag;

    @Field(type = FieldType.Boolean)
    private Boolean fileFlag;

    @Field(type = FieldType.Boolean)
    private Boolean preMeetingFlag;

    @Field(type = FieldType.Boolean)
    private Boolean permitFlag;

    @Field(type = FieldType.Date)
    private Date lastDoneDate;

    @Field(type = FieldType.Date)
    private Date lastDoneCounter;

    @Field(type = FieldType.Integer)
    private Integer timerValue;

    @Field(type = FieldType.Long)
    private Long deptId;

    @Field(type = FieldType.Long)
    private Long postId;

    @Field(type = FieldType.Keyword)
    private String chargePostNameCn;

    @Field(type = FieldType.Text, analyzer = "english")
    private String chargePostNameEn;

    @Field(type = FieldType.Boolean)
    private Boolean shoreFlag;

    @Field(type = FieldType.Keyword) // 状态字段
    private String workCardStatus;

    @Field(type = FieldType.Keyword)
    private String completeStatus;

    @Field(type = FieldType.Keyword)
    private String completeContent;

    @Field(type = FieldType.Date)
    private Date completedDate;

    @Field(type = FieldType.Keyword)
    private String maintStaff;

    @Field(type = FieldType.Boolean)
    private Boolean alertFlag;

    @Field(type = FieldType.Keyword)
    private String alertRemark;

    @Field(type = FieldType.Keyword)
    private String vesselApprovePerson;

    @Field(type = FieldType.Date)
    private Date vesselApproveDate;

    @Field(type = FieldType.Keyword)
    private String vesselApproveRemark;

    @Field(type = FieldType.Keyword)
    private String shoreApprovePerson;

    @Field(type = FieldType.Date)
    private Date shoreApproveDate;

    @Field(type = FieldType.Keyword)
    private String shoreApproveRemark;

    @Field(type = FieldType.Keyword)
    private String devCode;

    @Field(type = FieldType.Boolean)
    private Boolean replanFlag;

    @Field(type = FieldType.Boolean)
    private Boolean safetyFlag;

    @Field(type = FieldType.Boolean)
    private Boolean keyFlag;

    @Field(type = FieldType.Keyword)
    private String operFlag;
}